package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 结算记录
 * </p>
 *
 * @author linan
 * @date 2023-05-26
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionSettlementRefundStatusEnum", description = "退款状态 #{NOT_APPLIED:未申请;REQUESTED:已申请;REFUNDED:已退款;NO_REFUND:无须退款;REJECTED:被驳回-枚举")
public enum ExhibitionSettlementRefundStatusEnum implements BaseEnum {

    /**
     * NOT_APPLIED="未申请"
     */
    NOT_APPLIED("未申请"),
    /**
     * REQUESTED="已申请"
     */
    REQUESTED("已申请"),
    /**
     * REFUNDED="已退款"
     */
    REFUNDED("已退款"),
    /**
     * NO_REFUND="无须退款"
     */
    NO_REFUND("无须退款"),
    /**
     * REJECTED="被驳回"
     */
    REJECTED("被驳回"),
    /**
     * REFUNDING="退款中"
     */
    REFUNDING("退款中"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionSettlementRefundStatusEnum match(String val, ExhibitionSettlementRefundStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionSettlementRefundStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionSettlementRefundStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_APPLIED,REQUESTED,REFUNDED,NO_REFUND,REJECTED", example = "NOT_APPLIED")
    public String getCode() {
        return this.name();
    }

}
